import { ApiProperty } from '@nestjs/swagger'
import { IsNotEmpty } from 'class-validator'

export class CreatePostDto {
  @ApiProperty({ description: '文章id' })
  readonly id: number

  @ApiProperty({ description: '标题', required: true })
  @IsNotEmpty({ message: '文章标题必填' })
  readonly title: string

  @ApiProperty({ description: '作者', required: true })
  @IsNotEmpty({ message: '作者必填' })
  readonly author: string

  @ApiProperty({ description: '内容', required: true })
  @IsNotEmpty({ message: '文章内容必填' })
  readonly content: string

  @ApiProperty({
    description: '缩略图',
    example: 'http://xxx.png',
    required: false
  })
  readonly thumbUrl: string

  @ApiProperty({ description: '分类id', enum: [1, 2, 3] })
  readonly type: number

  @ApiProperty({
    description: '创建时间',
    example: '2023-03-22 12:33:59',
    required: false
  })
  readonly createTime: Date

  @ApiProperty({
    description: '更新时间',
    example: '2023-03-22 12:33:59',
    required: false
  })
  readonly updateTime: Date
}
